// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Core;
using Elastic.Clients.Elasticsearch.Serialization;
using Elastic.Transport;
using System;
using System.Runtime.Serialization;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Core.HealthReport;

[JsonConverter(typeof(ImpactAreaConverter))]
public enum ImpactArea
{
	[EnumMember(Value = "search")]
	Search,
	[EnumMember(Value = "ingest")]
	Ingest,
	[EnumMember(Value = "deployment_management")]
	DeploymentManagement,
	[EnumMember(Value = "backup")]
	Backup
}

internal sealed class ImpactAreaConverter : JsonConverter<ImpactArea>
{
	public override ImpactArea Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
	{
		var enumString = reader.GetString();
		switch (enumString)
		{
			case "search":
				return ImpactArea.Search;
			case "ingest":
				return ImpactArea.Ingest;
			case "deployment_management":
				return ImpactArea.DeploymentManagement;
			case "backup":
				return ImpactArea.Backup;
		}

		ThrowHelper.ThrowJsonException();
		return default;
	}

	public override void Write(Utf8JsonWriter writer, ImpactArea value, JsonSerializerOptions options)
	{
		switch (value)
		{
			case ImpactArea.Search:
				writer.WriteStringValue("search");
				return;
			case ImpactArea.Ingest:
				writer.WriteStringValue("ingest");
				return;
			case ImpactArea.DeploymentManagement:
				writer.WriteStringValue("deployment_management");
				return;
			case ImpactArea.Backup:
				writer.WriteStringValue("backup");
				return;
		}

		writer.WriteNullValue();
	}
}

[JsonConverter(typeof(IndicatorHealthStatusConverter))]
public enum IndicatorHealthStatus
{
	[EnumMember(Value = "yellow")]
	Yellow,
	[EnumMember(Value = "unknown")]
	Unknown,
	[EnumMember(Value = "red")]
	Red,
	[EnumMember(Value = "green")]
	Green
}

internal sealed class IndicatorHealthStatusConverter : JsonConverter<IndicatorHealthStatus>
{
	public override IndicatorHealthStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
	{
		var enumString = reader.GetString();
		switch (enumString)
		{
			case "yellow":
				return IndicatorHealthStatus.Yellow;
			case "unknown":
				return IndicatorHealthStatus.Unknown;
			case "red":
				return IndicatorHealthStatus.Red;
			case "green":
				return IndicatorHealthStatus.Green;
		}

		ThrowHelper.ThrowJsonException();
		return default;
	}

	public override void Write(Utf8JsonWriter writer, IndicatorHealthStatus value, JsonSerializerOptions options)
	{
		switch (value)
		{
			case IndicatorHealthStatus.Yellow:
				writer.WriteStringValue("yellow");
				return;
			case IndicatorHealthStatus.Unknown:
				writer.WriteStringValue("unknown");
				return;
			case IndicatorHealthStatus.Red:
				writer.WriteStringValue("red");
				return;
			case IndicatorHealthStatus.Green:
				writer.WriteStringValue("green");
				return;
		}

		writer.WriteNullValue();
	}
}